<?php

function curPageURL() {
	$currentFile = $_SERVER["PHP_SELF"];
	$parts = Explode('/', $currentFile);
	return $parts[count($parts) - 1];
}

function encodeS($s) {
	return htmlspecialchars(stripslashes($s));
}

function decodeS($s) {
        $s = str_replace("\"", "\'", $s);
	return htmlspecialchars_decode($s);
}

function get($name) {
	if(isset($_GET[$name])){
		return $_GET[$name];
	}
	return '';
}

function post($name) {
	if(isset($_POST[$name])){
		return $_POST[$name];
	}
	return '';
}

function get_session($name) {
	if(session_is_registered($name)){
		return $_SESSION[$name];
	}
	return '';
}

function set_session($name, $value) {
	$_SESSION[$name] = $value;
}

function redirect($url)
{
	header("Location: ".$url, 5);
}

?>